import ampub from 'ampub';
import fa from 'fa';
import { ajax, clearOneTypeToast, promptBox, toast } from 'nc-lightapp-front';
import {
    disableUsufructAssetTab,
    emptyUsufructAssetTab,
    enableUsufructAssetTab,
    getUsufructAssetTab,
    setTemplateDefautValue,
    showOrHideIsdepfornewcard,
    usufructAssetAfterEvent
} from '.';
import constants from '../../constants';
import { depmethodUtils, getPkTransitype } from '../../utils';
import { setFAParamStatus } from './headButtonClick';
import setStatus, { setUsufructassetBtns } from './setStatus';
import { updateDeptmethodItem } from './utils';

const { utils } = ampub;
const { cardUtils } = utils;
const { rateBeforeEvent } = cardUtils;
let { checkDepmethod } = depmethodUtils;
const { utils: { multiLangUtils: { getMultiLangByID }, msgUtils: { showMessage } } } = ampub;
const {
	fa_components: { ReferLinkage: { referLinkageClear }, AccbookAndPeriod: { getAccbooksAndPeriods } },
	fa_utils: { metaUtil }
} = fa;

const {
	CARD_BTNS,
	UISTATE,
	URL,
	MODAL_ID,
	FIELDS,
	ReferLinkageClearConfig,
	AREA: {
		CARD: {
			ASSET_ALL: assetAllArea,
			BASIC_INFO_AREA: basicInfoForm,
			FINANCE_AREA: financeForm,
			USEDEPT_TAB: usedept_tab,
			USUFRUCTASSET_AREA: usufructassetForm,
			SUBEQUIP_TAB: subequip_tab,
			LRZX_TAB: lrzx_tab
		}
	}
} = constants;

/**
 * 表头的编辑后事件处理
 *
 * @param props
 * @param moduleId
 * @param field
 * @param newValue
 * @param oldValue
 * @param record
 * @param fromAccbookChange 是否账簿切换
 * @returns {undefined}
 */

export default function afterEvent(
	props,
	moduleId,
	field,
	newValue,
	oldValue,
	record,
	formValue,
	fromAccbookChange = false
) {
	const that = this;

	// 仅使用权页签字段
	if (
		this.usufructasset_tab_fields.has(field) &&
		field !== 'pk_transactor' &&
		field !== 'pk_lessor' &&
		field !== 'pk_tenantry'
	) {
		return usufructAssetAfterEvent.call(this, props, moduleId, field, newValue, oldValue, record, null, false);
	}

	//联动处理
	referLinkageClear(this.props, field, ReferLinkageClearConfig, 'form', moduleId);

	//不需要关联处理的字段不需要发请求到后台， 包括自定义项
	if (FIELDS.NORELATION_FIELD.includes(field) || field.startsWith(FIELDS.DEF_FIELD)) {
		return;
	}

	if (field === 'pk_org' || field === 'pk_org_v') {
		orgAfterEdit(that, props, moduleId, field, newValue, oldValue);
	} else {
		eventHandler.call(that, props, moduleId, field, newValue, oldValue, record, formValue, fromAccbookChange);
	}

	// 公共处理
	publicHandler.call(that);
}

/**
 * 表头编辑后公共处理
 */
function publicHandler() {
	showOrHideIsdepfornewcard.call(this);
}

// 编辑后事件
function eventHandler(props, moduleId, field, newValue, oldValue, record, formValue, fromAccbookChange = false) {
	let { props: { cardTable, form, pageConfig }, state: { accbooks, currentPkaccbook, pageCode } } = this;
	let status = props.getUrlParam('status');

	let that = this;
	let param = {
		isCategoryChange: false, //只是在编辑后使用
		field,
		hisvo_size: accbooks ? accbooks.length : 0
	};

	let { newasset_flag } = pageConfig;
    let usufructasset_flag = form.getFormItemsValue(basicInfoForm, 'usufructasset_flag').value;

	// 使用权资产
	if (field === 'usufructasset_flag') {
		if (newValue && newValue.value) {
			enableUsufructAssetTab.call(this);
			this.isNeedCalculateLeaseLiabilities = true;

			this.setState({ usufructasset_flag: true }, () => {
				if (status == UISTATE.ADD) {
					emptyUsufructAssetTab.call(this);
					// 设置默认值
					let meta = props.meta.getMeta();
					let defaultValue = {};
					meta[usufructassetForm].items.map((item) => {
						if (item.attrcode === 'interest_base') {
							defaultValue['interest_base'] = item.options[0];
						} else if (item.attrcode === 'payment_type') {
							// 期初=1,期末=2
							defaultValue['payment_type'] = item.options[1];
						}
					});
					form.setFormItemsValue(basicInfoForm, defaultValue);

					setTemplateDefautValue(props, meta);
				}
				setUsufructassetBtns.call(that, status);
				
				// 开始使用日期默认为追溯调整日期（原始卡片）
				if(pageConfig.newasset_flag == 0){
					let retrospective_date = form.getFormItemsValue(basicInfoForm, 'retrospective_date').value;
					form.setFormItemsValue(basicInfoForm, { begin_date: { value: retrospective_date } });
				}
			});
		} else {
			disableUsufructAssetTab.call(this);
			this.isNeedCalculateLeaseLiabilities = false;
			this.setState({ usufructasset_flag: false }, () => {
				setUsufructassetBtns.call(that, status);
			});
		}
		// 使用权资产资产类别变更
		param.isCategoryChange = true;
	}

	// 资产类别
	if ([ 'pk_category' ].includes(field)) {
		//that.editCategoryWhenUpdate = true;
		param.isCategoryChange = true;
		if (!newValue || !newValue.value) {
			//新值为空
			that.setState({
				financeShowFlag: false,
				accbooks: [],
				currentPkaccbook: ''
			});
			this.isNeedCalculateLeaseLiabilities = false;
			return;
		}
		// 修改资产类别后，年折现率也一起变，需要提示请先计算租赁负债
		this.isNeedCalculateLeaseLiabilities = true;
	}

    // 使用权卡片，币种编辑后（租入合同的卡片不可修改原币币种，在编辑前事件中校验）
	if (field === 'pk_currency' && usufructasset_flag) {
        // 自制卡片修改币种，提示请先计算租赁负债
		this.isNeedCalculateLeaseLiabilities = true;
	}

	//使用权的编辑后，清空多使用部门页签数据
	if (field === 'pk_equiporg') {
		cardTable.setTableData(usedept_tab, { rows: [] });
	}

	// 建卡日期
	if (field === 'business_date') {
		if (!newValue || !newValue.value) {
			currentPkaccbook = '';
			that.setState({
				financeShowFlag: false,
				accbooks: [],
				currentPkaccbook: ''
			});
		}
	}

	//使用部门处理
	if (field === FIELDS.USEDEP_FLAG) {
		usedeptChangeHandler.call(that, newValue.value);
	}

	//如果当前编辑的不是[资产类别、财务组织]，且资产类别字段为空，则不发送后台请求(关联项的处理是在平台的编辑后处理)
	//之所以这样做是由于类别为空后，后台取账簿数据时会出现错误  @zhangypm 2018-12-12
	let pk_category = form.getFormItemsValue(basicInfoForm, 'pk_category').value;
	if (![ 'pk_category', 'pk_org', 'pk_org_v', 'pk_usedept' ].includes(field) && !pk_category) {
		return;
	}

	let assetData = undefined;
	//有账簿
	if (currentPkaccbook) {
		//组装用于提交到后台的数据
		this.syncFinanceForm(field, newValue);
		this.syncDataForCommit();
		assetData = Object.values(this.assetDataMap);
	} else {
		//currentPkaccbook 为空时， assetDataMap 还没有值，需要从界面上取值
		assetData = form.getAllFormValue(basicInfoForm);
		assetData = [ assetData.rows[0] ];
	}

	let pk_transitype = getPkTransitype.call(this, this.curr_transiType);
	if (!pk_transitype) {
		showMessage(props, { color: 'danger', content: '交易类型初始化失败，请关闭页签后重试！' });
		return;
	}
	let userJson = {
		nodecode: pageConfig.nodecode,
		current_accbook: currentPkaccbook,
		fromAccbookChange: fromAccbookChange,
		transi_type: pageCode,
		pk_transitype,
		newasset_flag,
		bill_source: 'handin',
		// 8表示东8区，-8表示西8区
		client_time_zone: (0 - new Date().getTimezoneOffset() / 60)
	};

	let newValueObj = newValue ? { value: newValue.value, display: newValue.display } : {};
	let oldValueObj = oldValue ? { value: oldValue.value, display: oldValue.display } : {};

	let data = {
		attrcode: field,
		newValue: newValueObj,
		oldValue: oldValueObj,
		customValue: userJson,
		grid: {
			pageid: pageCode,
			model: {
				areacode: assetAllArea,
				areaType: 'table',
				rows: assetData
			}
		}
	};

	// 判断存在使用权资产
	if (usufructasset_flag) {
		//使用权资产
		data['bodysMap'] = {
			//使用权资产
			[usufructassetForm]: {
				pageid: pageCode,
				model: {
					areacode: usufructassetForm,
					rows: getUsufructAssetTab.call(this),
					areaType: 'table'
				}
			}
		};
	}

	ajax({
		url: URL.headafteredit,
		data,
		async: false,
		success: (res) => {
			let { success, data } = res;
			if (success) {
				if (field === 'pk_org' || field === 'pk_org_v') {
					orgAfterEventBackHandler.call(that, data);
				} else {
					afterEventBackHandler.call(that, data, param);
				}
			}
		},
		error: (err) => {
			//清空当前字段值
			let emptyVal = { diplay: '', value: '', scale: oldValue && oldValue.scale ? oldValue.scale : -1 };
			if (field === 'usufructasset_flag') {
				form.setFormItemsValue(moduleId, { pk_category: emptyVal });
			} else {
				form.setFormItemsValue(moduleId, { [field]: emptyVal });
			}

			showMessage(props, { color: 'danger', content: err.message });
			if ([ 'pk_category', 'usufructasset_flag', 'business_date' ].includes(field)) {
				that.setState({
					financeShowFlag: false,
					accbooks: [],
					currentPkaccbook: ''
				});
			}
		}
	});
}

/**
 * 财务组织编辑后事件
 */
function orgAfterEventBackHandler(data) {
	const { props: { form } } = this;
	let assetData = data['toUIObject']['heads'][0][assetAllArea];

	form.setAllFormValue({
		[basicInfoForm]: assetData
	});

	let paramVO = data['paramVO'];
	setFAParamStatus.call(this, paramVO);

	// 更新精度
	this.updateScale();

	const pk_org = this.getHeadAttributeValue(data['toUIObject'], 'pk_org');
	getMinUnclosePeriod(pk_org);

	// 组织切换和刷新必须执行
	this.clearBodies();
}

/**
 * 编辑后事件返回处理（除了 财务组织字段 ）
 */
function afterEventBackHandler(data, param) {
	const { props: { form } } = this;
	//后台对当前账簿进行了处理，如果前台已经有选中的账簿，则后台就返回该账簿为当前账簿；
	//如果前台还未选中账簿，则后台设置业务账簿为当前选中账簿
	let { business_accbook, otherUserData, toUIObject: { heads, bodysMap } } = data;
	// let {usufructasset_tab : {usufructasset_tab: { rows : {[0] : {values : { pk_handledept_v }}}}}} = bodysMap;

	let { relativeData } = otherUserData;
	if (relativeData) {
		Object.assign(this.relativeData, relativeData);
	}

	this.business_accbook = business_accbook;

	if (param.field === 'business_date') {
		businessDateAfterEdit(this, heads, param);
	}
	if (param.field === 'pk_transactor') {
		//设置经办部门
		let handledeptV = bodysMap.usufructasset_tab.usufructasset_tab.rows[0].values.pk_handledept_v;
		form.setFormItemsValue(basicInfoForm, {
			pk_handledept_v: { display: handledeptV.display, value: handledeptV.value }
		});
	}
	if (param.field === 'pk_lessor') {
		//设置出租方
		let lessorv = bodysMap.usufructasset_tab.usufructasset_tab.rows[0].values.pk_lessor_v;
		form.setFormItemsValue(basicInfoForm, { pk_lessor_v: { display: lessorv.display, value: lessorv.value } });
	}
	if (param.field === 'pk_tenantry') {
		//设置承租方
		let tenantryV = bodysMap.usufructasset_tab.usufructasset_tab.rows[0].values.pk_tenantry_v;
		form.setFormItemsValue(basicInfoForm, {
			pk_tenantry_v: { display: tenantryV.display, value: tenantryV.value }
		});
	}

	//更新界面上的数据
	updateValue.call(this, data, param);

	//更新业务参数设置
	updateParam.call(this, data, param);

	setStatus.call(this, this.props);
	otherRelativeAfterEdit(this, data, param);
}

//更新数据
function updateValue(data, param) {
	const { props: { form, cardTable } } = this;
	let that = this;
	let { current_accbook, business_accbook, toUIObject: { heads, bodysMap } } = data;

    // 表头必须更新，如果新增时则更新精度
	let assetAllData = [];
	if (heads) {
		heads.forEach((head) => {
			if (head[assetAllArea] && head[assetAllArea].rows && head[assetAllArea].rows.length > 0) {
				assetAllData = assetAllData.concat(head[assetAllArea].rows);
			}
		});
	}

	if (current_accbook) {
		//返回的数据中存在账簿数据
		//解析返回的 assetvo 数据
		let rows = assetAllData;
		let assetDataMap = {};
		let accbooks = [];
		for (let row of rows) {
			const {
				values: {
					pk_accbook: { value: pk_accbook, display: accbookName },
					naturemonth: { value: naturemonth },
					pk_depmethod
				}
			} = row;
			//使用月限
			let naturemonthDisplay = this.convertNatureMonthDisplay(naturemonth);
			if (naturemonthDisplay) {
				row['values']['naturemonth_display'] = naturemonthDisplay;
			}

			//折旧方法 是否停用 判断处理，如果折旧方法已经停用，则清空该字段
			row['values']['pk_depmethod'] = checkDepmethod(pk_depmethod, this.depmethods);

			accbooks.push({ pk_accbook, accbookName });
			assetDataMap[pk_accbook] = row;
		}

		this.assetDataMap = assetDataMap;

		let pkaccbook = current_accbook; //需要展示数据的账簿

		//资产类别变化 或者 当前还未选中账簿
		if (param.isCategoryChange || !this.state.currentPkaccbook) {
			//给账簿排序，业务账簿放在前面
			let accbooksNew = [];
			accbooksNew = accbooks.filter((accbookObj) => {
				return accbookObj['pk_accbook'] === business_accbook;
			});
			accbooksNew = accbooksNew.concat(
				accbooks.filter((accbookObj) => {
					return accbookObj['pk_accbook'] !== business_accbook;
				})
			);
			this.setState({
				accbooks: accbooksNew,
				currentPkaccbook: current_accbook //前台使用后台返回的当前账簿
			});
		}

		//设置基本区域form的值
		this.basicInfoData = assetDataMap[pkaccbook];
		//使用权页签解析
		if (bodysMap[usufructassetForm] && bodysMap[usufructassetForm][usufructassetForm]) {
			const { [usufructassetForm]: { [usufructassetForm]: { rows: usufructrows } } } = bodysMap;
			if (usufructrows && usufructrows[0]) {
				//相同字段以表头为主【pk_group, pk_org, pk_org_v】
				let valuesNew = Object.assign(usufructrows[0].values, this.basicInfoData.values);
				this.basicInfoData.values = valuesNew;
			}
		}

		const basicInfoData4Form = this.wrapBasicInfoData();
		// 设置财务区的值
		const accbookData4Form = this.wrapAccbookData(pkaccbook);

		//更新form数据
		let updateFormFunc = () => {
			let formValueObj = {};
			if (basicInfoData4Form) {
				formValueObj[basicInfoForm] = basicInfoData4Form;
			}
			if (accbookData4Form && that.state.financeShowFlag) {
				formValueObj[financeForm] = accbookData4Form;
			}

			form.setAllFormValue(formValueObj);

			//更新折旧方法相关字段的item 属性
			updateDeptmethodItem.call(that, this.props, accbookData4Form);
		};

		//财务区域未展开，展开财务区
		if ([ 'pk_category', 'usufructasset_flag' ].includes(param.field) && !this.state.financeShowFlag) {
			this.setState(
				{
					financeShowFlag: true
				},
				() => {
					updateFormFunc();
				}
			);
		} else {
			updateFormFunc();
		}
	} else {
        //使用权页签解析 - 必须更新，如果新增时则更新精度
        if (bodysMap[usufructassetForm] && bodysMap[usufructassetForm][usufructassetForm]) {
            const { [usufructassetForm]: { [usufructassetForm]: { rows: usufructrows } } } = bodysMap;
            if (usufructrows && usufructrows[0]) {
                Object.assign(assetAllData[0].values, usufructrows[0].values);
            }
        }
		//返回的数据中没有账簿数据，只更新基本区域form数据
		form.setAllFormValue({ [basicInfoForm]: { rows: assetAllData } });
	}
}

//建卡日期编辑后
function businessDateAfterEdit(that, newDataHeads, param) {
	let { hisvo_size: hisvos_length_old } = param;
	let pk_accbookSet_new = new Set();
	let assetAllData = [];
	if (newDataHeads) {
		newDataHeads.forEach((head) => {
			if (head[assetAllArea] && head[assetAllArea].rows && head[assetAllArea].rows.length > 0) {
				assetAllData = assetAllData.concat(head[assetAllArea].rows);
			}
		});
	}
	assetAllData.map((head) => {
		let { values: { pk_accbook: { value: pk_accbook } } } = head;
		pk_accbook && pk_accbookSet_new.add(pk_accbook);
	});
	let hisvos_length_new = pk_accbookSet_new.size;
	//本次编辑与上次编辑相比 有无变化 （账簿个数的变化认为是类别变化）
	// see nc.ui.fa.asset.event.AssetEventHandler.handleHeadAfterEditEvent()
	param.isCategoryChange = hisvos_length_old !== hisvos_length_new;
}

//由当前编辑字段引起的其他关联字段的编辑后处理
function otherRelativeAfterEdit(that, data, param) {
	const { props: { modal } } = that;
	let { otherUserData } = data;
	if (otherUserData) {
		let { relativeData } = otherUserData;
		//净残值率反算值
		let salvageReverse = relativeData && relativeData.salvageReverse;
		if (salvageReverse) {
			modal.show(MODAL_ID.ConfirmModal, {
				title: getMultiLangByID('201201504A-000053') /* 国际化：'提示'*/,
				content: getMultiLangByID('201201504A-000054') /* 国际化：净残值超出参数设置中（原值*净残值率）允许的最大误差；是否反算净残值率？*/,
				beSureBtnClick: () => {
					//更新净残值率
					metaUtil.updateFormItemValue(that.props, financeForm, 'salvagerate', salvageReverse);
				},
				//取消
				cancelBtnClick: () => {
					metaUtil.clearFormItemValue(that.props, financeForm, 'salvage');
				}
			});
		}
	}
}

//更新参数设置：如FA10,账簿参数等
function updateParam(data, param) {
	if ([ 'pk_category', 'usufructasset_flag' ].includes(param.field)) {
		//类别编辑后，更新FA10
		let { fa10param, accbookCurrency } = data['paramVO'];
		/* 阻止清空操作 */
		if (fa10param) {
			this.fa10param = fa10param;
		}
		if (accbookCurrency) {
			this.accbookCurrency = accbookCurrency;
		}
	}
}

//是否多使用部门切换处理
function usedeptChangeHandler(usedept_flag) {
	const { props: { form, cardTable, button, getUrlParam } } = this;
	if (usedept_flag) {
		//多使用部门
		//清空 使用部门 字段的数据
		form.setFormItemsValue(basicInfoForm, {
			[FIELDS.PK_USEDEPT]: { value: '', display: null }
		});

		// 设置 使用部门 可空
		let obj = {
			[FIELDS.PK_USEDEPT]: false
		};
		form.setFormItemsRequired(basicInfoForm, obj);

		// 设置 使用部门 不能编辑
		obj = {
			[FIELDS.PK_USEDEPT]: true
		};
		form.setFormItemsDisabled(basicInfoForm, obj);

		// 设置 多使用部门页签 可以编辑
		cardTable.toggleCardTable(usedept_tab, true);
		cardTable.setStatus(usedept_tab, UISTATE.EDIT);
		// 多使用部门页签上的按钮可以使用
		let btns = Object.values(CARD_BTNS.TABLE_HEAD.USEDEPT_TAB);
		button.setButtonVisible(btns, true);

		const status = getUrlParam('status');
		if ([ UISTATE.ADD, UISTATE.EDIT ].includes(status)) {
			// 增一行。
			cardTable.addRow(usedept_tab);
		}
	} else {
		//单使用部门
		//设置使用部门字段可以编辑
		let obj = {
			[FIELDS.PK_USEDEPT]: false
		};

		form.setFormItemsDisabled(basicInfoForm, obj);
		// 表头使用部门默认是否可空
		let defaultNotNull = this.state.usedeptIsNotNull;
		obj = {
			[FIELDS.PK_USEDEPT]: defaultNotNull
		};
		form.setFormItemsRequired(basicInfoForm, obj);

		// 设置表体页签不能编辑
		cardTable.toggleCardTable(usedept_tab, false);
		// 多使用部门页签上的按钮不可以使用
		let btns = Object.values(CARD_BTNS.TABLE_HEAD.USEDEPT_TAB);
		button.setButtonVisible(btns, false);

		// 把表体多使用部门数据清空
		cardTable.setTableData(usedept_tab, { rows: [] });
		cardTable.setStatus(usedept_tab, UISTATE.BROWSE);
	}
}

//获取选择组织所有账簿的最小未结帐月，并给出提示
function getMinUnclosePeriod(pk_org) {
	getAccbooksAndPeriods(pk_org, (res) => {
		let { success, data } = res;
		if (success && data && data.length) {
			//主账簿排在前面
			data.sort((a1, a2) => {
				if (a1.isMainbook && !a2.isMainbook) {
					return 1;
				} else if (!a1.isMainbook && a2.isMainbook) {
					return -1;
				} else {
					return 0;
				}
			});

			setTimeout(() => {
				let content = '';
				data.forEach((a1) => {
					let { accbookName, minUnClosebookPeriod: { accyear, period } } = a1;
					content +=
						accbookName +
						' ' +
						getMultiLangByID('201201504A-000009', {
							accyear,
							period
						}) +
						'\n';
				});
				toast({
					color: 'danger',
					className: 'toast-style',
					content: content,
					miniTime: 2.8
					//onClose: onClose,
				});
			}, 100);
		}
	});
}
//组织字段的编辑处理
function orgAfterEdit(that, props, moduleId, field, newValue, oldValue) {
	let isContinue = true; //是否继续执行后续操作

	if (oldValue && oldValue.value && (!newValue || oldValue.value !== newValue.value)) {
		//组织切换(包括置空)

		//弹出组织切换对话框
		let modalConfig = {
			color: 'warning',
			title: getMultiLangByID('orgChange-000001') /* 国际化处理: 确认修改*/,
			content: getMultiLangByID('orgChange-000000') /* 国际化处理: 是否修改组织，这样会清空您录入的信息? */,
			closeByClickBackDrop: false, //点击遮罩不关闭提示框
			//点击确定按钮事件
			beSureBtnClick: () => {
				if (newValue && newValue.value) {
					orgChangeHandler(that);
					eventHandler.call(that, props, moduleId, field, newValue, oldValue, null, null);
					isContinue = true;
				} else {
					emptyOrgHandler(that);
					isContinue = false;
				}

				if (isContinue) {
					that.props.resMetaAfterPkorgEdit();
				} else {
					that.props.initMetaByPkorg('pk_org');
				}
			},
			//取消按钮事件-恢复原来的值
			cancelBtnClick: () => {
				props.form.setFormItemsValue(moduleId, { [field]: oldValue });
				let data = {
					type: 'form',
					areaCode: moduleId,
					key: field,
					value: oldValue,
					callback: () => {},
					changedrows: null,
					index: null,
					formMetaCode: moduleId
				};
				props.handleRelationItems(data);
			}
		};

		promptBox(modalConfig);
	} else {
		//新增的
		eventHandler.call(that, props, moduleId, field, newValue, oldValue, null, null);
		that.props.resMetaAfterPkorgEdit();
	}
}

//组织清空处理
function emptyOrgHandler(that) {
	that.resetOnAdd();
	//清除最小未结账月消息
	clearOneTypeToast('danger');

	// 再次清空组织，解决模板上设置了默认组织的问题
	that.props.form.setFormItemsValue(basicInfoForm, { pk_org: { value: null, display: null } });
}

//组织切换
function orgChangeHandler(that) {
	const { props: { form } } = that;
	//删除账簿数据
	that.setState({
		financeShowFlag: false,
		accbooks: [],
		currentPkaccbook: ''
	});

	//清空资产类别
	form.setFormItemsValue(basicInfoForm, { pk_category: { value: '', display: '' } });

	emptyUsufructAssetTab.call(that);
	//清除最小未结账月消息
	clearOneTypeToast('danger');
}

